<template>
  <div class="personal-center">
    <div class="left-menu">
      <ul>
        <li :class="{ active: isActive('/user/hotel-orders') }">
          <router-link to="/user/hotel-orders">酒店订单</router-link>
        </li>
        <!-- <li :class="{ active: isActive('/scenic-orders') }">
          <router-link to="/scenic-orders">景点订单</router-link>
        </li>
        <li :class="{ active: isActive('/scenic-favorites') }">
          <router-link to="/scenic-favorites">景点收藏</router-link> -->
        <!-- </li> -->
        <li :class="{ active: isActive('/user/info') }">
          <router-link to="/user/info">个人资料</router-link>
        </li>
        <!-- <li :class="{ active: isActive('/avatar') }">
          <router-link to="/avatar">头像修改</router-link>
        </li>
        <li :class="{ active: isActive('/my-guide') }">
          <router-link to="/my-guide">我的攻略</router-link>
        </li>
        <li :class="{ active: isActive('/change-password') }">
          <router-link to="/change-password">密码修改</router-link>
        </li> -->
      </ul>
    </div>
    <div class="right-content">
      <router-view></router-view>
    </div>
  </div>
</template>

<script setup>
import { useRoute } from 'vue-router';

const route = useRoute();

const isActive = (path) => {
  return route.path === path;
};
</script>

<style scoped>
.personal-center {
  display: flex;
}

.left-menu {
  width: 220px;
  border-right: 1px solid #ddd;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.left-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.left-menu li {
  margin-bottom: 15px;
}

.left-menu li a {
  display: block;
  text-decoration: none;
  color: #333;
  font-size: 16px;
  padding: 10px 15px;
  border-radius: 4px;
  font-weight: 500;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 悬浮效果 */
.left-menu li a:hover {
  background-color: #4CAF50;
  color: white;
}

/* 激活状态 */
.left-menu li.active a {
  background-color: #388e3c;
  color: white;
  font-weight: bold;
}

/* 设置左侧菜单的过渡效果 */
.left-menu li a {
  transition: background-color 0.3s, color 0.3s, padding-left 0.3s;
}

/* 添加左侧菜单的宽度和样式 */
.left-menu li a:hover {
  padding-left: 20px; /* 悬浮时增加左侧内边距 */
}

/* 可选的字体变化 */
.left-menu li a.active {
  font-size: 18px;
  font-weight: bold;
}

.right-content {
  flex-grow: 1;
  padding: 20px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
</style>
